package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.RuralPovertyAlleviationMaterialsDonate;
import com.ruoyi.rural.mapper.RuralPovertyAlleviationMaterialsDonateMapper;
import com.ruoyi.rural.service.IRuralPovertyAlleviationMaterialsDonateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 扶贫物资捐赠管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-26
 */
@Service
public class RuralPovertyAlleviationMaterialsDonateServiceImpl implements IRuralPovertyAlleviationMaterialsDonateService 
{
    @Autowired
    private RuralPovertyAlleviationMaterialsDonateMapper ruralPovertyAlleviationMaterialsDonateMapper;

    /**
     * 查询扶贫物资捐赠管理
     * 
     * @param id 扶贫物资捐赠管理主键
     * @return 扶贫物资捐赠管理
     */
    @Override
    public RuralPovertyAlleviationMaterialsDonate selectRuralPovertyAlleviationMaterialsDonateById(String id)
    {
        return ruralPovertyAlleviationMaterialsDonateMapper.selectRuralPovertyAlleviationMaterialsDonateById(id);
    }

    /**
     * 查询扶贫物资捐赠管理列表
     * 
     * @param ruralPovertyAlleviationMaterialsDonate 扶贫物资捐赠管理
     * @return 扶贫物资捐赠管理
     */
    @Override
    public List<RuralPovertyAlleviationMaterialsDonate> selectRuralPovertyAlleviationMaterialsDonateList(RuralPovertyAlleviationMaterialsDonate ruralPovertyAlleviationMaterialsDonate)
    {
        return ruralPovertyAlleviationMaterialsDonateMapper.selectRuralPovertyAlleviationMaterialsDonateList(ruralPovertyAlleviationMaterialsDonate);
    }

    /**
     * 新增扶贫物资捐赠管理
     * 
     * @param ruralPovertyAlleviationMaterialsDonate 扶贫物资捐赠管理
     * @return 结果
     */
    @Override
    public int insertRuralPovertyAlleviationMaterialsDonate(RuralPovertyAlleviationMaterialsDonate ruralPovertyAlleviationMaterialsDonate)
    {
        ruralPovertyAlleviationMaterialsDonate.setId(UUID.randomUUID().toString());
        ruralPovertyAlleviationMaterialsDonate.setCreateTime(DateUtils.getNowDate());
        return ruralPovertyAlleviationMaterialsDonateMapper.insertRuralPovertyAlleviationMaterialsDonate(ruralPovertyAlleviationMaterialsDonate);
    }

    /**
     * 修改扶贫物资捐赠管理
     * 
     * @param ruralPovertyAlleviationMaterialsDonate 扶贫物资捐赠管理
     * @return 结果
     */
    @Override
    public int updateRuralPovertyAlleviationMaterialsDonate(RuralPovertyAlleviationMaterialsDonate ruralPovertyAlleviationMaterialsDonate)
    {
        ruralPovertyAlleviationMaterialsDonate.setUpdateTime(DateUtils.getNowDate());
        return ruralPovertyAlleviationMaterialsDonateMapper.updateRuralPovertyAlleviationMaterialsDonate(ruralPovertyAlleviationMaterialsDonate);
    }

    /**
     * 批量删除扶贫物资捐赠管理
     * 
     * @param ids 需要删除的扶贫物资捐赠管理主键
     * @return 结果
     */
    @Override
    public int deleteRuralPovertyAlleviationMaterialsDonateByIds(String[] ids)
    {
        return ruralPovertyAlleviationMaterialsDonateMapper.deleteRuralPovertyAlleviationMaterialsDonateByIds(ids);
    }

    /**
     * 删除扶贫物资捐赠管理信息
     * 
     * @param id 扶贫物资捐赠管理主键
     * @return 结果
     */
    @Override
    public int deleteRuralPovertyAlleviationMaterialsDonateById(String id)
    {
        return ruralPovertyAlleviationMaterialsDonateMapper.deleteRuralPovertyAlleviationMaterialsDonateById(id);
    }

    @Override
    public List<RuralPovertyAlleviationMaterialsDonate> selectRuralPovertyAlleviationMaterialsDonateListByWeek(RuralPovertyAlleviationMaterialsDonate ruralPovertyAlleviationMaterialsDonate) {
        return ruralPovertyAlleviationMaterialsDonateMapper.selectRuralPovertyAlleviationMaterialsDonateListByWeek(ruralPovertyAlleviationMaterialsDonate);
    }
}
